package Controls
{
	import Input.GameInput;
	
	import Objects.GameSprite;
	
	import Plugin.ItemClickPlugin;
	
	import Setup.ZOrder;

	public class Menu extends GameSprite
	{
		protected var buttons:Array;
		public function Menu()
		{
			super();
			
			buttons=createButtons();
			
			gs.addItemClick(buttons,handler);
		}
		protected function createButtons():Array
		{
			return [];
		}
		override protected function $update():void
		{
			if(GameInput.i.mDown)
			{
				if(!mOver)
				{
					kill();
				}
			}
		}
		public function kill():void
		{
			remove();
		}
		public function show():void
		{
			
		}
		public final function born(zOrder:String=""):void
		{
			if(!zOrder)
			{
				zOrder=ZOrder.PANEL;
			}
			gs.addGameObject(this,zOrder);
			show();
		}
		protected final function handler(key:String):void
		{
			_handler(key);
			kill();
		}
		protected function _handler(key:String):void
		{
			
		}
	}
}